<%@ include file="/html/init.jsp"%>

<%
	String redirect = PortalUtil.getCurrentURL(renderRequest);
%>
<liferay-ui:success key="model-added" message='<%= LanguageUtil.get(pageContext, "model-added") %>'/>
<liferay-ui:success key="model-updated" message='<%= LanguageUtil.get(pageContext, "model-updated") %>'/>
<liferay-ui:success key="model-deleted" message='<%= LanguageUtil.get(pageContext, "model-deleted") %>'/>
<portlet:defineObjects />

<aui:button-row>
	<portlet:actionURL var="addModelURL" name="addModelURL">
		<portlet:param name="backURL" value="<%=redirect%>" />
		<portlet:param name="jspPage"
			value="/html/softuirulesengineportlet/modelAdd.jsp" />
		<portlet:param name="action" value="add" />
	</portlet:actionURL>
	<aui:button
		value='<%=LanguageUtil.get(pageContext, "add-model")%>'
		onClick="<%=addModelURL.toString()%>" />

	<portlet:actionURL var="addModelWSURL" name="addModelWSURL">
		<portlet:param name="backURL" value="<%=redirect%>" />
		<portlet:param name="jspPage"
			value="/html/softuirulesengineportlet/modelAddWS.jsp" />
		<portlet:param name="action" value="add" />
	</portlet:actionURL>

	<aui:button
		value='<%=LanguageUtil.get(pageContext, "add-modelWS")%>'
		onClick="<%=addModelWSURL.toString()%>" />
</aui:button-row>


<liferay-ui:search-container delta='5' emptyResultsMessage='<%= LanguageUtil.get(pageContext, "models-empty-results-message") %>'>
	<liferay-ui:search-container-results
		results="<%= modelsLocalServiceUtil.getmodelses(searchContainer.getStart(), searchContainer.getEnd()) %>"
		total="<%= modelsLocalServiceUtil.getmodelsesCount() %>"
	/>

	<liferay-ui:search-container-row
		className="com.targeter.rulesengine.model.models"
		keyProperty="_id"
		modelVar="models" escapedModel="<%= true %>"
	>
		
		<liferay-ui:search-container-column-text
			name='<%=LanguageUtil.get(pageContext, "modelName") %>'
			property="model"
		/>
		
		<liferay-ui:search-container-column-text
			name='<%=LanguageUtil.get(pageContext, "is-active") %>'
			property="active"
		/>
		
		<liferay-ui:search-container-column-jsp
			align="right"
			path="/html/softuirulesengineportlet/modelActions.jsp"
		/>
	</liferay-ui:search-container-row>

	<liferay-ui:search-iterator />
</liferay-ui:search-container>